Skip to content

[dotnet run] $(Device) global property missing during DeployToDevice target#53018

Open
jonathanpeppers wants to merge 1 commit intorelease/10.0.3xxfrom
dev/peppers/DeployToDeviceMissingDevice
Open

[dotnet run] $(Device) global property missing during DeployToDevice target#53018
jonathanpeppers wants to merge 1 commit intorelease/10.0.3xxfrom
dev/peppers/DeployToDeviceMissingDevice

Conversation

@jonathanpeppers
Copy link
Member

When the DeployToDevice target runs, and you selected a device from the dotnet run device selection prompt, $(Device) is blank!

This was because evaluation already occurred, so we have to invalidate the project, so it will occur in subsequent steps.

I could reproduce this in a test, so this verifies it will remain fixed for the future.

…ce` target

When the `DeployToDevice` target runs, and you selected a device from
the `dotnet run` device selection prompt, `$(Device)` is blank!

This was because evaluation already occurred, so we have to invalidate
the project, so it will occur in subsequent steps.

I could reproduce this in a test, so this verifies it will remain
fixed for the future.
Copilot AI review requested due to automatic review settings February 12, 2026 23:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes dotnet run device deployment scenarios where the selected device wasn’t flowing into subsequent MSBuild target execution (notably DeployToDevice) because the project had already been evaluated before the device was chosen.

Changes:

  • Invalidate the cached MSBuild evaluation in RunCommandSelector whenever Device (and optionally RuntimeIdentifier) is applied so later targets re-evaluate with the updated global properties.
  • Strengthen run-device tests to assert DeployToDevice logs include the expected Device (and RuntimeIdentifier for auto-selected devices).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Cli/dotnet/Commands/Run/RunCommand.cs Forces selector re-evaluation after setting Device so DeployToDevice sees updated global properties.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunSelectsDevice.cs Extends binlog assertions to validate DeployToDevice received/logged the selected Device/RuntimeIdentifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants